﻿''' <summary>Generic media file schema</summary>
Public Class MediaFile
    Inherits File

    'Public Sub New(ByVal content As String, ByVal format As IndexFormats, ByVal uri As String, ByVal last_modified_time As Date)
    '    MyBase.New(content, format, uri, last_modified_time)

    'End Sub


    Public Sub New(ByVal format As IndexFormats, ByVal uri As String, ByVal last_modified_time As Date)
        MyBase.New(String.Empty, format, uri, last_modified_time)

    End Sub

    ''' <summary>Width of images and videos (in pixels) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _width As Integer 
    ''' <summary>Height of images and videos (in pixels) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _height As Integer 
    ''' <summary>Average video bit rate for video files (in bits/sec) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _data_rate As Integer 
    ''' <summary>Average audio bit rate in audio and video files (in bits/sec) </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _bit_rate As Integer 
    ''' <summary>Channel count for audio files </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _channels As Integer 
    ''' <summary>Time length of music and video files (in 100 nanosecond units) </summary>
    <MarshalAs(UnmanagedType.U8)> _
    Private _length As Long 
    ''' <summary>Original time stamp of media file from the media device </summary>
    Private _original_date As date
    ''' <summary>Album title for music files </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _album_title As String
    ''' <summary>Artist for media file </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _artist As String
    ''' <summary>Genre/category for media file </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _genre As String
    ''' <summary>Lyrics for music files </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _lyrics As String
    ''' <summary>Number of tracks for music files </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _track_number As Integer 
    ''' <summary>Comment about the audio file </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _comment As String
    ''' <summary>Keywords associated with the media file </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _keywords As String
    ''' <summary>Info tip as reported from the shell </summary>
    <MarshalAs(UnmanagedType.BStr)> _
    Private _info_tip As String
    ''' <summary>Year published for media </summary>
    <MarshalAs(UnmanagedType.U4)> _
    Private _year_published As Integer



    ''' <summary>Album title for music files </summary>
    Public Property Album_title() As String
        Get
            Return _album_title
        End Get
        Set(ByVal value As String)
            _album_title = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Artist for media file </summary>
    Public Property Artist() As String
        Get
            Return _artist
        End Get
        Set(ByVal value As String)
            _artist = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Average audio bit rate in audio and video files (in bits/sec) </summary>
    Public Property Bit_rate() As Integer
        Get
            Return _bit_rate
        End Get
        Set(ByVal value As Integer)
            _bit_rate = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Channel count for audio files </summary>
    Public Property Channels() As Integer
        Get
            Return _channels
        End Get
        Set(ByVal value As Integer)
            _channels = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Comment about the audio file </summary>
    Public Property Comment() As String
        Get
            Return _comment
        End Get
        Set(ByVal value As String)
            _comment = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Average video bit rate for video files (in bits/sec) </summary>
    Public Property Data_rate() As Integer
        Get
            Return _data_rate
        End Get
        Set(ByVal value As Integer)
            _data_rate = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Genre/category for media file </summary>
    Public Property Genre() As String
        Get
            Return _genre
        End Get
        Set(ByVal value As String)
            _genre = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Height of images and videos (in pixels) </summary>
    Public Property Height() As Integer
        Get
            Return _height
        End Get
        Set(ByVal value As Integer)
            _height = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Info tip as reported from the shell </summary>
    Public Property Info_tip() As String
        Get
            Return _info_tip
        End Get
        Set(ByVal value As String)
            _info_tip = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Keywords associated with the media file </summary>
    Public Property Keywords() As String
        Get
            Return _keywords
        End Get
        Set(ByVal value As String)
            _keywords = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Time length of music and video files (in 100 nanosecond units) </summary>
    Public Property Length() As Long
        Get
            Return _length
        End Get
        Set(ByVal value As Long)
            _length = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Lyrics for music files </summary>
    Public Property Lyrics() As String
        Get
            Return _lyrics
        End Get
        Set(ByVal value As String)
            _lyrics = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Original time stamp of media file from the media device </summary>
    Public Property Original_date() As Date
        Get
            Return _original_date
        End Get
        Set(ByVal value As Date)
            _original_date = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Number of tracks for music files </summary>
    Public Property Track_number() As Integer
        Get
            Return _track_number
        End Get
        Set(ByVal value As Integer)
            _track_number = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Width of images and videos (in pixels) </summary>
    Public Property Width() As Integer
        Get
            Return _width
        End Get
        Set(ByVal value As Integer)
            _width = value
            SetOtherPropertiesFlag()
        End Set
    End Property
    ''' <summary>Year published for media </summary>
    Public Property Year_published() As Integer
        Get
            Return _year_published
        End Get
        Set(ByVal value As Integer)
            _year_published = value
            SetOtherPropertiesFlag()
        End Set
    End Property



    'Protected Overrides Sub AddRequredProperties(ByVal e As [Event])
    '    MyBase.AddRequredProperties(e)


    'End Sub

    Protected Overrides Sub AddOtherProperties(ByVal e As [Event])
        MyBase.AddOtherProperties(e)


        e.AddProperty("width", Me._width)


        e.AddProperty("height", Me._height)


        e.AddProperty("data_rate", Me._data_rate)



        e.AddProperty("bit_rate", Me._bit_rate)


        e.AddProperty("channels", Me._channels)



        e.AddProperty("length", Me._length)

        e.AddProperty("original_date", Me._original_date.ToOADate)


        If Not String.IsNullOrEmpty(_album_title) Then e.AddProperty("album_title", _album_title)
        If Not String.IsNullOrEmpty(_artist) Then e.AddProperty("artist", _artist)
        If Not String.IsNullOrEmpty(_genre) Then e.AddProperty("genre", _genre)
        If Not String.IsNullOrEmpty(_lyrics) Then e.AddProperty("lyrics", _lyrics)

        e.AddProperty("track_number", Me._track_number)



        If Not String.IsNullOrEmpty(_comment) Then e.AddProperty("comment", _comment)


        If Not String.IsNullOrEmpty(_keywords) Then e.AddProperty("keywords", _keywords)


        If Not String.IsNullOrEmpty(_info_tip) Then e.AddProperty("info_tip", _info_tip)


        e.AddProperty("year_published", Me._year_published)



    End Sub




End Class

